package com.jiazhong.shuzu;

public class Test05 {
    public static void main(String[] args) {
        int a[][]={{1,2,3},{4,5,6},{7,8,9}};
        int sum=0;
        for (int i=0;i<a.length;i++){
            for (int j=0;j<a[i].length;j++){
                System.out.print(" "+a[i][j]);
            }
            System.out.println();
        }
        for (int i=0;i< a.length;i++){
            int j=0,k=2;
            sum+=a[i][j];
            sum+=a[i][k];
            if (a[i][j]==a[i][k])
                sum-=a[i][j];
            j++;k--;
        }
        System.out.println(sum);
    }
}
